﻿
@{
    Layout = null;
}

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>
        博客后台管理系统
    </title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="~/Areas/Back/css/x-admin.css" media="all">
    <script src="~/Areas/Back/lib/layui/layui.js"></script>
    <script type="text/javascript" src="~/Areas/Back/js/x-layui.js"></script>
</head>
<body>
    <form class="layui-form" id="bd">
        <!-- 提示：如果你不想用form，你可以换成div等任何一个普通元素 -->
        <div class="layui-form-item">
            <label class="layui-form-label">标题:</label>
            <div class="layui-input-inline">
                <input type="text" name="Title" id="Title" placeholder="" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">阅览量:</label>
            <div class="layui-input-inline">
                <input type="text" name="ReadTimes" id="ReadTimes" placeholder="" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">内容简介:</label>
            <div class="layui-input-inline">
                <input type="text" name="SimpleInfo" id="SimpleInfo" placeholder="" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">内容:</label>
            <div class="layui-input-inline">
                <input type="text" name="Cont" id="Cont" placeholder="" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">图片地址:</label>
            <div class="layui-input-inline">
                <input type="text" name="MainPicUrl" id="MainPicUrl" placeholder="" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">标签:</label>
            <div class="layui-input-inline">
                <input type="text" name="Tags" id="Tags" placeholder="" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">作者:</label>
            <div class="layui-input-inline">
                <input type="text" name="Source" id="Source" placeholder="" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">种类:</label>
            <div class="layui-input-inline">
                <input type="text" name="Type" id="Type" placeholder="" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">填入时间:</label>
            <div class="layui-input-inline">
                <input type="text" name="CreateTime" id="CreateTime" placeholder="" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">发布时间:</label>
            <div class="layui-input-inline">
                <input type="text" name="PubTime" id="PubTime" placeholder="" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">是否发布:</label>
            <div class="layui-input-inline">
                <select name="IsPub" id="IsPub">
                    <option value="是">是</option>
                    <option value="否">否</option>
                </select>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">类别:</label>
            <div class="layui-input-inline">
                <select name="ShowType" id="ShowType">
                    <option value="相册">相册</option>
                    <option value="文章">文章</option>
                </select>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn" lay-submit lay-filter="*" id="Baocun">保存</button>
                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            </div>
        </div>
    </form>
    <script>
            layui.use(['form', 'laydate','layer'], function () {
                var form = layui.form;
                var laydate = layui.laydate;
                var $ =layui.$;
                var layer = layui.layer;
                laydate.render({
                    elem: '#CreateTime' //指定元素
                });
                laydate.render({
                    elem: '#PubTime' //指定元素
                });
                //执行一个laydate实例
                form.on('submit(*)', function (data) {
                    var str = $("#bd").serialize();
                    $.post("/Back/Gallery/BaoCun", str, function (re) {
                        if (re > 0) {
                            parent.layer.msg("添加成功");
                            parent.layui.$("#Baocun").click();
                            var index = parent.layer.getFrameIndex(window.name);
                            parent.layer.close(index);
                            parent.location.reload(); //刷新父页面
                        } else {
                            parent.layer.msg("添加失败");
                        }
                    }, "text");
                    return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
                });
            });
            //各种基于事件的操作，下面会有进一步介绍
    </script>
</body>
</html>